#include "logo.h"

char *butfirst(void)
{
     int i;
     int k;
     char *ans;
     char *val;
     char *s;
     char str[MAXVALUE] ="\0";
     char valStr[MAXVALUE] ="\0";
     char ansStr[MAXVALUE] ="\0";

     val =valStr;
     ans =ansStr;
     s =str;
     strcpy(val,getValue());
     if (val[0] == '[')
     {
        i=1;
        k=0;
        strcpy(ans,"[");
        while (i<strlen(val)-1)
        {
              if ((!k)&&(i>1)&&((val[i] ==' ')||(val[i] =='[')))
              {
                 break;
              }else if (val[i] =='[')
              {
                    k++;
              }else if (val[i] ==']')
              {
                    k--;
              }
              printf("char of first is %c,%d\n",val[i],k);
              if ((val[i] =='\"')&&(strlen(ans) ==0))
              {
                 i++;
                 continue;
              }
              i++;
        }
        while (isspace(val[i]))
        {
              i++;
        }
        s =val+i;
        strcat(ans,s);
        goto RE;
     }
     s =val+1;
     strcpy(ans,s);
     RE:
            return ans;
}
